﻿@{
    Layout = null;
}
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台登录</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link rel="shortcut icon" href="~/favicon.ico" type="image/x-icon" />
    <link href="~/css/font.css" rel="stylesheet" />
    <link rel="stylesheet" href="~/css/xadmin.css">
    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />
    <script src="~/lib/jquery/jquery-3.2.1.min.js"></script>
    <script src="~/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="~/js/xadmin.js"></script>

</head>
<body class="login-bg">

    <div class="login layui-anim layui-anim-up">
        <div class="message">Auth后台管理系统</div>
        <div id="darkbannerwrap"></div>

        <form class="layui-form"id="login_form" action="#" >
            <input name="username" placeholder="用户名" type="text" lay-verify="required" class="layui-input">
            <hr class="hr15">
            <input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input">
            <hr class="hr15">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" name="code" lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"><img src="@Url.Action("ValidateCode","Login")" onclick="this.src+='?'" /></div>
            </div>
            <hr class="hr15">
            <input value="登录" id="loginBtn" style="width:100%;" type="button" onclick="login();">
            <hr class="hr20">
        </form>
    </div>

    <script>
        function login() {
            var index = layer.load(1, {
                shade: [0.3, '#fff'] //0.1透明度的白色背景
            });
            $.ajax({
                url:'@Url.Action("Index", "Login")',
                type: 'post',
                dataType: 'json',
                data: $("#login_form").serialize(),
                success: function (res) {
                    if (res.success) {
                        layer.close(index);
                        location.href = "/Home/Index";
                    }
                    else {
                        layer.close(index);
                        layer.msg(res.msg);
                    }
                }
            });
        }
        $(function () {
            $(document).keydown(function (e) {
                if (e.which === 13)
                    login();
            });

        });

    </script>
    <!-- 底部结束 -->
</body>
</html>